﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using SmartSpace.Core;

namespace SsTool.Controls.Workflow
{
    /// <summary>
    /// Interaction logic for ActivityPanel2.xaml
    /// </summary>
    public partial class ActivityPanel2 : BaseActivityPanel
    {
        public ActivityPanel2()
        {
            InitializeComponent();
        }
    }

    public partial class BaseActivityPanel : UserControl, IActivityBox
    {
        public List<BaseActivityPanel> Children { get; set; }
        public Guid Id { get; set; }

        public Point CenterPos { get; private set; }

        public BaseActivityPanel()
        {
            Children = new List<BaseActivityPanel>();
        }

        public virtual Point GetOutPos()
        {
            return new Point(CenterPos.X, CenterPos.Y + this.Height / 2);
        }

        public virtual Point GetInPos()
        {
            return new Point(CenterPos.X, CenterPos.Y - this.Height / 2);
        }

        public void SetCenterPos(Point centerPos)
        {
            CenterPos = centerPos;
            Canvas.SetTop(this, CenterPos.Y - (this.Height) / 2);
            Canvas.SetLeft(this, CenterPos.X - (this.Width) / 2);
        }

        public void Select()
        {
            this.Opacity = 0.5;
        }
        public void UnSelect()
        {
            this.Opacity = 1;
        }
    }
}
